package com.guigu.qingcheng.servicegoods.service.impl;

import com.guigu.qingcheng.servicegoods.service.TbCategoryService;
import com.guigu.qingcheng.servicegoods.service.TbSkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Init implements InitializingBean {

    @Autowired
    private TbCategoryService tbCategoryService;

    @Autowired
    private TbSkuService tbSkuService;

    public void afterPropertiesSet() throws Exception {
        System.out.println("‐‐‐缓存预热‐‐‐");
        tbCategoryService.saveCategoryTreeToRedis();//加载商品分类导航缓存
        tbSkuService.saveAllPriceToRedis();//加载价格数据
    }

}
